<template>
	<view class="page">
		<template v-if="costList.length > 0">
		<view class="section margin-bottom-default"  v-for="(item, index) in costList">
			<view class="flex padding-m ">
				<view class="flex-3">{{item.name}}</view>
				<view>{{numFilter(item.value)}}</view>
			</view>
		</view>
		</template>
		<view style="display: flex;justify-content: center;  align-items: center; height: 100vh;" v-else>
			<view>本期暂无数据！</view>
		</view>
	</view>
</template>

<script>
	import home from '../../js/api/home'

	export default {
		data() {
			return {
				costList: []
			}
		},
		onLoad() {
			this.loadCash()
		},
		methods: {
			numFilter(value) {
				let realVal = parseFloat(value ? value : 0).toFixed(2)
				return realVal
			},
			loadCash() {
				home.cost().then((res) => {
					this.costList = res
					console.log(this.costList)
				})
			},
		}
	}
</script>

<styl lang="scss" scoped>

</style>